package com.fate.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fate.domain.SysMenu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysMenuMapper extends BaseMapper<SysMenu> {
    @Select("SELECT DISTINCT\n" +
            "\tt1.*\n" +
            "FROM\n" +
            "\tsys_menu AS t1\n" +
            "JOIN sys_role_menu AS t2 ON (t1.menu_id = t2.menu_id)\n" +
            "JOIN sys_user_role AS t3 ON (t2.role_id = t3.role_id)\n" +
            "WHERE t3.user_id=#{value} AND (t1.type = 0 OR t1.type = 1) \n")
    List<SysMenu> findSysUserMenu(Long sysUserId);
}